package com.zw.chat.repository;

import com.zw.chat.domain.ChatMessage;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

public interface ChatMessageRepository extends MongoRepository<ChatMessage, String> {

    @Query("{'session._id':?0}")
    List<ChatMessage> queryChatMessageBySessionId(String sessionId);

    @Query("{'session._id':?0}")
    List<ChatMessage> queryChatMessageBySessionId(String sessionId, Pageable pageable);
}
